﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NuevaMAquina.aspx.cs" Inherits="ApuestasNetInterfaz.NuevaMAquina" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Agregar Maquina</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        
      <div class="center">
        <center>

      <h1><small>Ingresar una nueva Máquina</small></h1>
       <table border=0>
<tr>
	<td>Ciudad:</td>
	<td>
        <asp:TextBox ID="ciudad" runat="server"></asp:TextBox>
	</td>
</tr>
<tr>
	<td>Estado:</td>
	<td>
        <asp:TextBox ID="estado" runat="server"></asp:TextBox>
	</td>
</tr>
<tr>
	<td>Latitud:</td>
	<td>
	<asp:TextBox ID="maquina_lat" name="Latitud" runat="server"></asp:TextBox>
	</td>
</tr>

<tr>
	<td>Longitud:</td>
	<td>
	<asp:TextBox ID="maquina_long" name="Longitud" runat="server"></asp:TextBox>
	</td>
</tr>
</table>
</br>
            <asp:Button ID="Button1" runat="server" Text="Agregar" onclick="Button1_Click" />  

        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
        <script type="text/javascript">
            var centrodelmapa = new google.maps.LatLng(10.496420232955682, -66.906738281258);
            var parliament = new google.maps.LatLng(10.496420232955682, -66.906738281258);
            var marker;
            var map;

            function initialize() {
                var mapOptions = {
                    zoom: 14,
                    mapTypeId: google.maps.MapTypeId.ROADMAP,
                    center: centrodelmapa
                };

                map = new google.maps.Map(document.getElementById("map"),
            mapOptions);

                marker = new google.maps.Marker({
                    map: map,
                    draggable: true,
                    animation: google.maps.Animation.DROP,
                    position: parliament
                });
                google.maps.event.addListener(marker, 'click', toggleBounce);
                google.maps.event.addListener(marker, 'dragend', coordinates);
            }

            function toggleBounce() {

                if (marker.getAnimation() != null) {
                    marker.setAnimation(null);
                } else {
                    marker.setAnimation(google.maps.Animation.BOUNCE);
                }
            }
            function coordinates() {
                var point = new google.maps.LatLng(marker.getPosition().lat(), marker.getPosition().lng(), true);
                map.panTo(point);
                alert(maquina_lat.value);
              //  document.getElementById("maquina_lat").value = point.lat();
                document.getElementById("maquina_lat").value = "0";
                document.getElementById("maquina_long").value = point.lng();

            }
        </script>
      
        <body onload="initialize()"></body>
       
          <div id="map" style="width: 610px; height: 480px"></div>
          <div id="message"></div>
          <br></br>
        </center>
          
     
    </div>
   
    <div class="clr"></div>

    </div>
    </form>
</body>
</html>
